package com.mfl.controller.admin;

import com.mfl.common.PageResult;
import com.mfl.common.Result;
import com.mfl.pojo.dto.PostRemarkPageQueryDTO;
import com.mfl.service.PostRemarkService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController("adminPostRemarkController")
@RequestMapping("/cky/admin/postRemark")
@Slf4j
public class PostRemarkController {

    @Autowired
    private PostRemarkService postRemarkService;

    /**
     * 分页查询帖子评论
     * @param postRemarkPageQueryDTO
     * @return
     */
    @GetMapping("/pageQuery")
    public Result<PageResult> pageQuery(PostRemarkPageQueryDTO postRemarkPageQueryDTO){
        log.info("分页查询帖子评论：{}", postRemarkPageQueryDTO);
        PageResult pageResult = postRemarkService.pageQuery(postRemarkPageQueryDTO);
        return Result.success("",pageResult);
    }

    /**
     * 批量删除帖子评论
     * @param ids
     * @return
     */
    @DeleteMapping("/batchDelete")
    public Result batchDelete(@RequestParam List<Integer> ids){
        log.info("批量删除帖子评论");
        postRemarkService.batchDelete(ids);
        return Result.success("删除成功");
    }
}
